<?php

namespace App\Models\OpenShop\StartBusiness;

use App\Models\BaseModel;
use App\Models\Fee\FeeAnnualOrderModel;
use App\Models\OpenShop\InvestmentPromotion\OpenShopMainProcessModel;
use App\Models\OpenShop\InvestmentPromotion\OpenShopSignOrderModel;
use App\Models\OpenShop\InvestmentPromotion\OpenShopUploadFileResourceModel;
use App\Models\OpenShop\InvestmentPromotion\OpenShopUserBaseInfoModel;
use App\Models\OpenShop\InvestmentPromotion\OpenShopUserContractModel;
use App\Support\ChangeSupport;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\HasOne;

class OpenShopStartBusinessModel extends BaseModel
{
    use HasFactory;

    protected $table = "open_shop_start_business";

    protected $fillable = [
        'startHotMv', 'startShopPic',
    ];

    /**
     * @return array
     */
    public static function getOrderLogTranslate(): array
    {
        return [
            "eatInTotal"                => "堂食人数",
            "hasMonitorUint"            => [
                "type" => ChangeSupport::FILED_TYPE_ENUM,
                "desc" => "监控落地",
                "enum" => OpenShopStartBusinessModel::MONITOR_UNIT_MAP
            ],
            "hasRight"                  => [
                "type" => ChangeSupport::FILED_TYPE_ENUM,
                "desc" => "监控落地",
                "enum" => OpenShopStartBusinessModel::RIGHT_MAP
            ],
            "rightDetail"               => "竟对详情",
            "sellChannel"               => [
                "type" => ChangeSupport::FILED_TYPE_SELECT_ENUM,
                "desc" => "售卖渠道",
                "enum" => OpenShopStartBusinessModel::SELL_CHANNEL_MAP
            ],
            "employmentExperience"      => [
                "type" => ChangeSupport::FILED_TYPE_ENUM,
                "desc" => "从业经验",
                "enum" => OpenShopStartBusinessModel::EMPLOYMENT_EXPERIENCE_MAP
            ],
            "managementInput"           => [
                "type" => ChangeSupport::FILED_TYPE_ENUM,
                "desc" => "经营投入",
                "enum" => OpenShopStartBusinessModel::MANAGEMENT_INPUT_TYPE_MAP
            ],
            "degreeCooperation"         => [
                "type" => ChangeSupport::FILED_TYPE_ENUM,
                "desc" => "配合程度",
                "enum" => OpenShopStartBusinessModel::DEGREE_COOPERATION_TYPE
            ],
            "startBusinessTime"         => [
                "type" => ChangeSupport::FILED_TYPE_DATE_YMD,
                "desc" => "开业时间"
            ],
            "sellPriceType"             => [
                "type" => ChangeSupport::FILED_TYPE_ENUM,
                "desc" => "执行售价",
                "enum" => OpenShopStartBusinessModel::SELL_PRICE_TYPE
            ],
            "menuCategory"              => [
                "type" => ChangeSupport::FILED_TYPE_SELECT_ENUM,
                "desc" => "菜单品类",
                "enum" => OpenShopStartBusinessModel::MENU_CATEGORY_TYPE
            ],
            "staffCount"                => "员工数",
            "monthlyWages"              => [
                "type" => ChangeSupport::FILED_TYPE_PRICE,
                "desc" => "月工资金额",
            ],
            "startBusinessActivityDesc" => "开业活动描述",
            "promoteChancePointDesc"    => "提升机会点描述",
            "leaveBehindQuestionDesc"   => "遗留问题"
        ];
    }

    const HAS_RIGHT_YES = 1;
    const HAS_RIGHT_NO  = 2;
    const RIGHT_MAP     = [
        self::HAS_RIGHT_YES => "有",
        self::HAS_RIGHT_NO  => "无"
    ];

    const MONITOR_UNIT_YES = 1;
    const MONITOR_UNIT_NO  = 2;
    const MONITOR_UNIT_MAP = [
        self::MONITOR_UNIT_YES => "是",
        self::MONITOR_UNIT_NO  => "否",
    ];

    const SELL_CHANNEL_1   = 1;
    const SELL_CHANNEL_2   = 2;
    const SELL_CHANNEL_3   = 3;
    const SELL_CHANNEL_MAP = [
        self::SELL_CHANNEL_1 => "自助展柜",
        self::SELL_CHANNEL_2 => "扫码点餐",
        self::SELL_CHANNEL_3 => "吧台点单蛋糕柜"
    ];

    const EMPLOYMENT_EXPERIENCE_YES = 1;
    const EMPLOYMENT_EXPERIENCE_NO  = 2;
    const EMPLOYMENT_EXPERIENCE_MAP = [
        self::EMPLOYMENT_EXPERIENCE_YES => "有",
        self::EMPLOYMENT_EXPERIENCE_NO  => "无"
    ];

    const MANAGEMENT_INPUT_TYPE_1   = 1;
    const MANAGEMENT_INPUT_TYPE_2   = 2;
    const MANAGEMENT_INPUT_TYPE_3   = 3;
    const MANAGEMENT_INPUT_TYPE_MAP = [
        self::MANAGEMENT_INPUT_TYPE_1 => "全职参与",
        self::MANAGEMENT_INPUT_TYPE_2 => "休息日参与",
        self::MANAGEMENT_INPUT_TYPE_3 => "托管"
    ];

    const DEGREE_COOPERATION_TYPE_1 = 1;
    const DEGREE_COOPERATION_TYPE_2 = 2;
    const DEGREE_COOPERATION_TYPE_3 = 3;
    const DEGREE_COOPERATION_TYPE   = [
        self::DEGREE_COOPERATION_TYPE_1 => "高",
        self::DEGREE_COOPERATION_TYPE_2 => "中",
        self::DEGREE_COOPERATION_TYPE_3 => "低"
    ];

    const SELL_PRICE_TYPE_1 = 1;
    const SELL_PRICE_TYPE_2 = 2;
    const SELL_PRICE_TYPE_3 = 3;
    const SELL_PRICE_TYPE_4 = 4;
    const SELL_PRICE_TYPE_5 = 5;
    const SELL_PRICE_TYPE_6 = 6;
    const SELL_PRICE_TYPE_7 = 7;
    const SELL_PRICE_TYPE_8 = 8;
    const SELL_PRICE_TYPE   = [
        self::SELL_PRICE_TYPE_1 => "自选统一价",
        self::SELL_PRICE_TYPE_2 => "自选上浮价",
        self::SELL_PRICE_TYPE_3 => "自选下调价",
        self::SELL_PRICE_TYPE_4 => "自选特殊场景价",
        self::SELL_PRICE_TYPE_5 => "点单统一价",
        self::SELL_PRICE_TYPE_6 => "点单上浮价",
        self::SELL_PRICE_TYPE_7 => "点单下调价",
        self::SELL_PRICE_TYPE_8 => "点单特殊场景价",
    ];

    const MENU_CATEGORY_TYPE_1 = 1;
    const MENU_CATEGORY_TYPE_2 = 2;
    const MENU_CATEGORY_TYPE_3 = 3;
    const MENU_CATEGORY_TYPE_4 = 4;
    const MENU_CATEGORY_TYPE_5 = 5;
    const MENU_CATEGORY_TYPE   = [
        self::MENU_CATEGORY_TYPE_1 => "卤油炸串",
        self::MENU_CATEGORY_TYPE_2 => "臭豆腐",
        self::MENU_CATEGORY_TYPE_3 => "小份炸",
        self::MENU_CATEGORY_TYPE_4 => "布袋馍",
        self::MENU_CATEGORY_TYPE_5 => "酒饮",
    ];

    /**
     * @return HasMany
     */
    public function attachRel(): HasMany
    {
        return $this->hasMany(OpenShopUploadFileResourceModel::class, "orderNo", "orderNo");
    }

    /**
     * @return HasOne
     */
    public function userBaseInfoRel(): HasOne
    {
        return $this->hasOne(OpenShopUserBaseInfoModel::class, "orderNo", "orderNo");
    }

    /**
     * @return HasOne
     */
    public function signOrderRel(): HasOne
    {
        return $this->hasOne(OpenShopSignOrderModel::class, "orderNo", "orderNo");
    }

    /**
     * @return HasOne
     */
    public function mainProcessRel(): HasOne
    {
        return $this->hasOne(OpenShopMainProcessModel::class, "id", "mainProcessId");
    }

    public function mainProcessesRel(): HasMany
    {
        return $this->hasMany(OpenShopMainProcessModel::class, "id", "mainProcessId");
    }

    /**
     * @return HasOne
     */
    public function userContractRel(): HasOne
    {
        return $this->hasOne(OpenShopUserContractModel::class, "orderNo", "orderNo");
    }
}
